package com.apexedu.identity.entity;

import javax.persistence.*;
import java.util.List;

/**
 * TSysRole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "T_SYS_ROLE")
public class TSysRole implements java.io.Serializable {

	/**
	 * 希望类的不同版本对序列化兼容，只要确保类的不同版本具有相同的serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	private String roleid;
	private String rolename;
	private String state;
	private String memo;
    private String belongtoapp; //业务系统编号
    private String bizcode; //在业务系统中的编号

    private List<TSysUser> userList;//用户信息

	// Constructors

	/** default constructor */
	public TSysRole() {
	}

	/** minimal constructor */
	public TSysRole(String roleid) {
		this.roleid = roleid;
	}

    /** full constructor */
    public TSysRole(String roleid, String rolename, String state, String memo, String belongtoapp, String bizcode) {
        this.roleid = roleid;
        this.rolename = rolename;
        this.state = state;
        this.memo = memo;
        this.belongtoapp = belongtoapp;
        this.bizcode = bizcode;
    }

    // Property accessors
	@Id
	@Column(name = "ROLEID", unique = true, nullable = false, length = 50)
	public String getRoleid() {
		return this.roleid;
	}

	public void setRoleid(String roleid) {
		this.roleid = roleid;
	}

	@Column(name = "ROLENAME", length = 100)
	public String getRolename() {
		return this.rolename;
	}

	public void setRolename(String rolename) {
		this.rolename = rolename;
	}

	@Column(name = "STATE", length = 6)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "MEMO", length = 150)
	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

    @Column(name = "belongtoapp", length = 50)
    public String getBelongtoapp() {
        return belongtoapp;
    }

    public void setBelongtoapp(String belongtoapp) {
        this.belongtoapp = belongtoapp;
    }

    @Column(name = "bizcode", length = 50)
    public String getBizcode() {
        if(bizcode==null){
            bizcode = roleid;// 在权限中心中添加的角色，其业务编号bizcode，就是roleid
        }
        return bizcode;
    }

    public void setBizcode(String bizcode) {
        this.bizcode = bizcode;
    }

    @Transient
    public List<TSysUser> getUserList() {
        return userList;
    }

    public void setUserList(List<TSysUser> userList) {
        this.userList = userList;
    }
}